<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>资产负债</title>
<jsp:include page="../../import.jsp" flush="true" />
    <style type="text/css">
        .field button {
            height: 18px;
            font-size: 10px;
        }
    </style>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div class="pageIn2layout">
        <div class="pageIn2L_side">
            <div class="sqPanel">
                <div class="sqPanel_head"></div>
                <div class="sqPanel_body">
                    <ul class="links">
                        <li id="inNav_01" data-src="<%=path%>/customer/cstbscinfo/toFilFinanceDebtPage.do?cstId=${cstId}">资产负债表</li>
                        <li id="inNav_02" data-src="<%=path%>/customer/filFinancePro/toFilFinanceProPage.do?cstId=${cstId}">利润及利润分配表</li>
                        <li id="inNav_03" data-src="<%=path%>/customer/filFinanceCash/toFilFinanceCashPage.do?cstId=${cstId}">现金流量表</li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="pageIn2L_mid">
                <input name="cstId" id="cstId" type="text" style="display: none;" value="${cstId}"/>
                <form id="import_form">
                    <div class="fieldset1 tabel_col tabel_col_1 clearFix">
                        <div class="fieldBox col_100">
                            <div class="label">批量导入</div>
                            <div class="field">
                                <jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload.jsp" flush="true" >
                                    <jsp:param name="fileNum" value="1"/>
                                    <jsp:param name="filePath" value="customer/filcreditfinance"/>
                                </jsp:include>
                                <span id="addBatchBtn" class="sq-button sq-button-hasicon" onclick="addBatch();"><i class="sqBtnIco_33"></i>批量导入</span>
                                <span id="downTempBtn" class="sq-button sq-button-hasicon" onclick="downTemp();"><i class="sqBtnIco_8"></i>下载模板</span>
                                <span style="float:right;color:red;">注：只会读取一条数据,多填写的数据无效！</span>
                            </div>
                        </div>
                    </div>
                </form>
            <form id="formSet">
                <div class="fieldset2 clearFix">
                    <div class="caption">
                        <span class="title">报表信息</span>
                    </div>
                    <div class="table table_full">
                        <div class="table_cell labels" style="width: 300px;">
                            <div class="label_item">报表年份</div>
                            <div class="label_item">报表类型</div>
                            <div class="label_item">报表类型细分</div>
                            <div class="label_item">审计事务所名称</div>
                            <div class="label_item">审计人员名称</div>
                            <div class="label_item">审计时间</div>
                        </div>
                        <div class="table_cell fields formdiva">
                            <div class="field_item"><input name="belongDate" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item">
                                <select name="reporttype" data-value=" " validate="{required:true, select: true}">
                                    <option value="  " selected="selected">--请选择--</option>
                                    <c:forEach items="${reportTypeList}" var="opt">
                                        <option value="${opt.key}">${opt.value}</option>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                            <div class="field_item">
                                <select name="reportsubtype" data-value=" " validate="{required:true, select: true}">
                                    <option value="  " selected="selected">--请选择--</option>
                                    <c:forEach items="${reportsubTypeList}" var="opt">
                                        <option value="${opt.key}">${opt.value}</option>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                            <div class="field_item"><input name="auditinstitute" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="auditstaff" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="auditime" type="text" class="ui-textbox" value="" /></div>
                        </div>
                        <div class="table_cell fields formdivb">
                            <div class="field_item"><input name="belongDate" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item">
                                <select name="reporttype" data-value=" " validate="{required:true, select: true}">
                                    <option value="  " selected="selected">--请选择--</option>
                                    <c:forEach items="${reportTypeList}" var="opt">
                                        <option value="${opt.key}">${opt.value}</option>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                            <div class="field_item">
                                <select name="reportsubtype" data-value=" " validate="{required:true, select: true}">
                                    <option value="  " selected="selected">--请选择--</option>
                                    <c:forEach items="${reportsubTypeList}" var="opt">
                                        <option value="${opt.key}">${opt.value}</option>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                            <div class="field_item"><input name="auditinstitute" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="auditstaff" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="auditime" type="text" class="ui-textbox" value="" /></div>
                        </div>
                    </div>
                </div>
                <div class="fieldset2 clearFix">
                    <div class="caption">
                        <span class="title">流动资产</span>
                    </div>
                    <div class="table table_full">
                        <div class="table_cell labels" style="width: 300px;">
                            <div class="label_item">货币资金</div>
                            <div class="label_item">交易性金融资产</div>
                            <div class="label_item">应收票据</div>
                            <div class="label_item">应收帐款</div>
                            <div class="label_item">预付账款</div>
                            <div class="label_item">应收利息</div>
                            <div class="label_item">应收股利</div>
                            <div class="label_item">其他应收款</div>
                            <div class="label_item">存货</div>
                            <div class="label_item">一年内到期的非流动资产</div>
                            <div class="label_item">其他流动资产</div>
                            <div class="label_item">流动资产合计</div>
                            <div class="label_item">可供出售的金融资产</div>
                            <div class="label_item">持有至到期投资</div>
                            <div class="label_item">长期股权投资</div>
                            <div class="label_item">长期应收款</div>
                            <div class="label_item">投资性房地产</div>
                        </div>
                        <div class="table_cell fields formdiva">
                            <div class="field_item"><input name="currencyFunds" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="tradeFinanceAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsBills" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="prepaid" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsInterest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsDivident" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherAccount" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="stock" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="inYearLongAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="flowOtherAssets" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="flowAssetsTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="saleFinanceAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="holdMatureInvest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longOptionInvest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longTermAccount" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="realEstateInvest" type="text" class="ui-textbox" value="" /></div>
                        </div>
                        <div class="table_cell fields formdivb">
                            <div class="field_item"><input name="currencyFunds" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="tradeFinanceAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsBills" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="prepaid" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsInterest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="accountsDivident" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherAccount" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="stock" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="inYearLongAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="flowOtherAssets" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="flowAssetsTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="saleFinanceAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="holdMatureInvest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longOptionInvest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longTermAccount" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="realEstateInvest" type="text" class="ui-textbox" value="" /></div>
                        </div>
                    </div>
                </div>
                <div class="fieldset2 clearFix">
                    <div class="caption">
                        <span class="title">固定资产</span>
                    </div>
                    <div class="table table_full">
                        <div class="table_cell labels" style="width: 300px;">
                            <div class="label_item">固定资产原值</div>
                            <div class="label_item">在建工程</div>
                            <div class="label_item">工程物资</div>
                            <div class="label_item">固定资产清理</div>
                            <div class="label_item">生产性生物资产</div>
                            <div class="label_item">油气资产</div>
                            <div class="label_item">无形资产</div>
                            <div class="label_item">开发支出</div>
                            <div class="label_item">商誉</div>
                            <div class="label_item">长期待摊费用</div>
                            <div class="label_item">递延所得税资产</div>
                            <div class="label_item">其他非流动资产</div>
                            <div class="label_item">非流动资产合计</div>
                            <div class="label_item">资产总计</div>
                        </div>
                        <div class="table_cell fields formdiva">
                            <div class="field_item"><input name="fixedAssentOriginal" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="progressProject" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="projectSupplies" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="fixedClean" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="produceBiosAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="oilGasAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="invisibleNet" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="developExpend" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="goodwill" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longPrepaidFee" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="deferredTax" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherLongNet" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="nonflowAssetsTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="netTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                        </div>
                        <div class="table_cell fields formdivb">
                            <div class="field_item"><input name="fixedAssentOriginal" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="progressProject" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="projectSupplies" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="fixedClean" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="produceBiosAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="oilGasAsset" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="invisibleNet" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="developExpend" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="goodwill" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longPrepaidFee" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="deferredTax" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherLongNet" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="nonflowAssetsTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="netTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                        </div>
                    </div>
                </div>
                <div class="fieldset2 clearFix">
                    <div class="caption">
                        <span class="title">流动负债</span>
                    </div>
                    <div class="table table_full">
                        <div class="table_cell labels" style="width: 300px;">
                            <div class="label_item">短期借款</div>
                            <div class="label_item">交易性金融负债</div>
                            <div class="label_item">应付票据</div>
                            <div class="label_item">应付账款</div>
                            <div class="label_item">预收账款</div>
                            <div class="label_item">应付利息</div>
                            <div class="label_item">应付职工薪酬</div>
                            <div class="label_item">应交税费</div>
                            <div class="label_item">应付股利</div>
                            <div class="label_item">其他应付款</div>
                            <div class="label_item">一年内到期的非流动负债</div>
                            <div class="label_item">其他流动负债</div>
                            <div class="label_item">流动负债合计</div>
                            <div class="label_item">长期借款</div>

                            <div class="label_item">应付债券</div>
                            <div class="label_item">长期应付款</div>
                            <div class="label_item">专项应付款</div>
                            <div class="label_item">预计负债</div>
                            <div class="label_item">递延所得税负债</div>
                            <div class="label_item">其他非流动负债</div>
                            <div class="label_item">非流动负债合计</div>
                            <div class="label_item">负债合计</div>
                        </div>
                        <div class="table_cell fields formdiva">
                            <div class="field_item"><input name="shortLoan" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="tradeFinanceDabt" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeBills" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="advance" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeInterest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeWage" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="ldfzA" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeDividend" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherCopeSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="inYearLongDabt" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="ldfzD" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="flowDabtTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="longLoan" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeBond" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longCopeSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="specialPayment" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="ldfzC" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="deferredTexItem" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherLongDabt" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longDabtTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="dabtTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                        </div>
                        <div class="table_cell fields formdivb">
                            <div class="field_item"><input name="shortLoan" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="tradeFinanceDabt" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeBills" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="advance" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeInterest" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeWage" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="ldfzA" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeDividend" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherCopeSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="inYearLongDabt" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="ldfzD" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="flowDabtTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="longLoan" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="copeBond" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longCopeSection" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="specialPayment" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="ldfzC" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="deferredTexItem" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="otherLongDabt" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="longDabtTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="dabtTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                        </div>
                    </div>
                </div>
                <div class="fieldset2 clearFix">
                    <div class="caption">
                        <span class="title">所有者权益</span>
                    </div>
                    <div class="table table_full">
                        <div class="table_cell labels" style="width: 300px;">
                            <div class="label_item">实收资本（或股本）</div>
                            <div class="label_item">资本公积</div>
                            <div class="label_item">减：库存股</div>
                            <div class="label_item">盈余公积</div>
                            <div class="label_item">未分配利润</div>
                            <div class="label_item">所有者权益合计</div>
                            <div class="label_item">负债及所有者权益合计</div>
                        </div>
                        <div class="table_cell fields formdiva">
                            <div class="field_item"><input name="paidCapital" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="capitalReserve" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="stockCapital" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="surplusReserve" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="notProfit" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="owerTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="dabtOwerTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                        </div>
                        <div class="table_cell fields formdivb">
                            <div class="field_item"><input name="paidCapital" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="capitalReserve" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="stockCapital" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="surplusReserve" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="notProfit" type="text" class="ui-textbox" value="" /></div>
                            <div class="field_item"><input name="owerTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                            <div class="field_item"><input name="dabtOwerTotal" type="text" class="ui-textbox" value="" validate="{required:true}" /><span class="requiredSymbol">*</span></div>
                        </div>
                    </div>
                </div>
                <div class="btnsBox" id="saveBtn">
                    <span id="saveBtn1" class="sq-button sq-button-round" onclick="saveFormDate()">保存</span>
                </div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function () {
        $('.pageIn2L_side .links').pageInSideLink({currentNav: 'inNav_01'});
        $("#import_form").ligerForm();
        $("#formSet").ligerForm({
            validate: true
        });
        $(".formdivb").each(function(){
        	$(this).hide();
        });
        initFormData();
        SetIframe_height();
    });
    //下载模板
    function downTemp(){
        window.location.href="<%=path%>/resource/template/filcreditfinance/FinanceDebtSheet.xls";
    }
    //是否启用输入选择框(1是，0否)
    function isSwitch(type){

        if(type==0){
            $('#formSet select').each(function(){
                var ligeruiid = $(this).attr('ligeruiid');
                liger.get(ligeruiid).setDisabled();
            });
            $('#formSet .ui-textbox').each(function(){
                var ligeruiid = $(this).attr('ligeruiid');
                liger.get(ligeruiid).setDisabled(true);
            });
            $('#saveBtn').css("display","none");
        }else{
            $('#formSet select').each(function(){
                var ligeruiid = $(this).attr('ligeruiid');
                liger.get(ligeruiid).setEnabled();
            });
            $('#formSet .ui-textbox').each(function(){
                var ligeruiid = $(this).attr('ligeruiid');
                liger.get(ligeruiid).setEnabled(true);
            });
            $('#saveBtn').css("display","block");
            SetIframe_height();
        }
    }
    //初始化数据
    function initFormData(){
        var _cstid=$("#cstId").val();
        if(!_cstid){
            return;
        }
        var _url = '<%=path%>/customer/filFinanceDebt/selectDebtList.do';
        AjaxUtils.ajaxGet(_url, {cstId:_cstid}, function(msg){
            if(msg.success == 1){
                setFormData(msg.data);//设置数据

                isSwitch(0);
            }else{
                UIUtils.alertError(msg.info);
            }
        }, false);
    }
    //赋值
    function setFormData(data){
        if(data != undefined && data !=null && data.length!=0){
            if(data[0] != undefined && data[0]!=null){
                var forma = data[0];
                var objKeys = Object.keys(forma);
                for(var i = 0; i<objKeys.length; i++){
                    if(objKeys[i] != 'id'){
                        var ligeruiid = $(".formdiva [name="+objKeys[i]+"]").attr('ligeruiid');
                        if(ligeruiid) {
                        liger.get(ligeruiid).setValue(forma[objKeys[i]]);
                        }
                    }
                }
            }
            /* if(data[1] != undefined && data[1]!=null){
                var formb = data[1];
                var objKeys = Object.keys(formb);
                for(var i = 0; i<objKeys.length; i++){
                    if(objKeys[i] != 'id') {
                        var ligeruiid = $(".formdivb [name="+objKeys[i]+"]").attr('ligeruiid');
                        if(ligeruiid) {
                            liger.get(ligeruiid).setValue(formb[objKeys[i]]);
                        }
                    }
                }
            } */
        }
    }
    //取值
    function getFormValue(){
        var perList = [];
        var formdatea = {};
        /* var formdateb = {}; */
        var _cstid=$("#cstId").val();
        formdatea['cstId']=_cstid;
        /* formdateb['cstId']=_cstid; */
        $('.formdiva').each(function(i,a){
            $('.ui-textbox, select',a).each(function(i,b){
                var _name=$(b).attr('name');
                var _value=$(b).val();
                formdatea[_name]=_value;
            });
        });
        /* $('.formdivb').each(function(i,a){
            $('.ui-textbox, select',a).each(function(i,b){
                var _name=$(b).attr('name');
                var _value=$(b).val();
                formdateb[_name]=_value;
            });
        }); */
        perList.push(formdatea);
        /* perList.push(formdateb); */
        return JSON.stringify(perList);
    }

    //保存事件
    function saveFormDate(){
            var form = liger.get("formSet");
            if (!form.valid()) {
                top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            if(parseFloat($('.formdiva input[name=dabtOwerTotal]').val()).toFixed(2)!=(parseFloat($('.formdiva input[name=dabtTotal]').val())+parseFloat($('.formdiva input[name=owerTotal]').val())).toFixed(2)){
                top.$.ligerDialog.SQalert({content: "第一列填报数据必须符合规则：负债及所有者权益合计=负债合计+所有者权益合计",SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            /* if(parseFloat($('.formdivb input[name=dabtOwerTotal]').val()).toFixed(2)!=(parseFloat($('.formdivb input[name=dabtTotal]').val())+parseFloat($('.formdivb input[name=owerTotal]').val())).toFixed(2)){
                top.$.ligerDialog.SQalert({content: "第二列填报数据必须符合规则：负债及所有者权益合计=负债合计+所有者权益合计",SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            } */
            if($('.formdiva input[name=netTotal]').val()!=$('.formdiva input[name=dabtOwerTotal]').val()){
                top.$.ligerDialog.SQalert({content: "第一列填报数据必须符合规则：资产总计=负债及所有者权益合计",SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            };
            /* if($('.formdivb input[name=netTotal]').val()!=$('.formdivb input[name=dabtOwerTotal]').val()){
                top.$.ligerDialog.SQalert({content: "第二列填报数据必须符合规则：资产总计=负债及所有者权益合计",SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }; */
            var url = '<%=path%>/customer/filFinanceDebt/addDebt.do';
            var wait_dialog;
            var data = {};
            data["cstId"] = $("#cstId").val();
            data["formData"] = getFormValue();
            $.ajax({
                type: 'post',
                dataType:'json',
                data:data,
                url: url,
                beforeSend: function(){
                    wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                    isSwitch(0);
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                        top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
                    }else{
                        top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
                    }
                }
            });
    }
    //批量导入
    function addBatch(){
        //获取上传文件地址
        var files=getUploadResultParams();
        if(files&&files.length>0){
            var filePath=files[0].filePath;
            var fileExtension = filePath.substring(filePath.lastIndexOf('.') + 1);
            if(fileExtension!='xls'&&fileExtension!='XLS'){
                $.ligerDialog.SQalert({content: "请上传.xls后缀的文件", SQ_type: "warn"});
                return;
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType:'json',
                data:"filePath="+filePath,
                url: '<%=path%>/customer/filFinanceDebt/financeDebtXls.do',
                beforeSend: function(){
                    wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                        setFormData(msg.data);
                        isSwitch(1);
                    }else{
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    }
                }
            });
        }else{
            $.ligerDialog.SQalert({content: "请先上传文件", SQ_type: "warn"});
        }
    }
</script>
</body>
</html>